package com.futureway.test.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Entity
@Table
@AllArgsConstructor
@NoArgsConstructor
public class UserCourse {

	@EmbeddedId
	private UserCourseIdKey key;

	public UserCourse(Integer userId, Integer courseId) {
		super();
		this.key = new UserCourseIdKey(userId, courseId);
	}

	@Data
	@AllArgsConstructor
	@NoArgsConstructor
	@Embeddable
	public static class UserCourseIdKey implements Serializable {

		private static final long serialVersionUID = 1L;

		@Column
		private Integer userId;

		@Column
		private Integer courseId;
	}

}
